#include <cstdio>
#include <cstring>

char a[ 1000001 ], b[ 6 ];

int main( )
{
    int t, i, j, ans, l1, l2;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%s%s", a, b);
        ans = 0;
        l1 = strlen( a );
        l2 = strlen( b );
        for ( i = 0; i < l1 - l2 + 1; i++ )
        {
            for ( j = 0; j < l2; j++ )
                if ( a[ i + j ] != b[ j ] )
                    break;
            if ( j == l2 )
            {
                ans++;
                i += l2 - 1;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}
